//
//  SpringAnimationViewModel.m
//  Home
//
//  Created by 曹连华 on 2019/7/2.
//  Copyright © 2019 曹连华. All rights reserved.
//

#import "SpringAnimationViewModel.h"

@implementation SpringAnimationViewModel

- (void)resetDataSource {
    [self.dataSource resetRowListInSection:[self rows]];    
}

- (NSArray <SpringAnimationTVCellModel *>* )rows {
    
    SpringAnimationTVCellModel * rotation = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"旋转动画(默认z轴)" subTitle:@"transform.rotation" formValue:@(0) toValue:@(-2*M_PI)];
    
    SpringAnimationTVCellModel * rotationX = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"X轴旋转动画" subTitle:@"transform.rotation.x" formValue:@(0) toValue:@(2*M_PI)];
    
    SpringAnimationTVCellModel * rotationY = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"Y轴旋转动画" subTitle:@"transform.rotation.y" formValue:@(0) toValue:@(2*M_PI)];
    
    SpringAnimationTVCellModel * rotationZ = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"Z轴旋转动画" subTitle:@"transform.rotation.z" formValue:@(0) toValue:@(2*M_PI)];
    
    SpringAnimationTVCellModel * scale = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"缩放动画" subTitle:@"transform.scale" formValue:@(1) toValue:@(0.4)];
    
    SpringAnimationTVCellModel * scaleX = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"X轴缩放动画" subTitle:@"transform.scale.x" formValue:@(0) toValue:@(1)];
    
    SpringAnimationTVCellModel * scaleY = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"Y轴缩放动画" subTitle:@"transform.scale.y" formValue:@(0) toValue:@(1)];
    
    SpringAnimationTVCellModel * scaleZ = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"Z轴缩放动画" subTitle:@"transform.scale.z" formValue:@(1) toValue:@(0)];
    
    SpringAnimationTVCellModel * translation = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"平移动画" subTitle:@"transform.translation" formValue:[NSValue valueWithCGPoint:CGPointMake(0, 0)] toValue:[NSValue valueWithCGPoint:CGPointMake(100, 400)]];
    
    SpringAnimationTVCellModel * translationX = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"X轴平移动画" subTitle:@"transform.translation.x" formValue:@(0) toValue:@(100)];
    
    SpringAnimationTVCellModel * translationY = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"Y轴平移动画" subTitle:@"transform.translation.y" formValue:@(0) toValue:@(100)];
    
    SpringAnimationTVCellModel * position = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"中心点位移动画" subTitle:@"position" formValue:[NSValue valueWithCGPoint:CGPointMake(0, 0)] toValue:[NSValue valueWithCGPoint:CGPointMake(100, 400)]];
    
    SpringAnimationTVCellModel * positionX = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"中心点位移动画" subTitle:@"position.x" formValue:@(0) toValue:@(100)];
    
    SpringAnimationTVCellModel * positionY = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"中心点位移动画" subTitle:@"position.y" formValue:@(0) toValue:@(100)];
    
    SpringAnimationTVCellModel * opacity = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"透明度动画" subTitle:@"opacity" formValue:@(1) toValue:@(0.5)];
    
    SpringAnimationTVCellModel * backgroundColor = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"背景色动画" subTitle:@"backgroundColor" formValue:(id)[UIColor blueColor].CGColor toValue:(id)[UIColor greenColor].CGColor];
    
    SpringAnimationTVCellModel * cornerRadius = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"圆角动画" subTitle:@"cornerRadius" formValue:@(0) toValue:@(50)];
    
    SpringAnimationTVCellModel * borderWidth = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"边框动画" subTitle:@"borderWidth" formValue:@(0) toValue:@(10)];
    
    SpringAnimationTVCellModel * shadowColor = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"阴影颜色动画" subTitle:@"shadowColor" formValue:(id)[UIColor redColor].CGColor toValue:(id)[UIColor greenColor].CGColor];
    
    SpringAnimationTVCellModel * shadowOffset = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"阴影偏移量动画" subTitle:@"shadowOffset" formValue:[NSValue valueWithCGPoint:CGPointMake(0, -10)] toValue:[NSValue valueWithCGPoint:CGPointMake(0, 10)]];
    
    SpringAnimationTVCellModel * shadowOpacity = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"阴影透明度动画" subTitle:@"shadowOpacity" formValue:@(1) toValue:@(0.3)];
    
    SpringAnimationTVCellModel * shadowRadius = [[SpringAnimationTVCellModel alloc]initWithCellClass:@"SpringAnimationTVCell" title:@"阴影圆角动画" subTitle:@"shadowRadius" formValue:@(5) toValue:@(15)];
    
    return @[rotation,rotationX,rotationY,rotationZ,
             scale,scaleX,scaleY,scaleZ,
             translation,translationX,translationY,
             position,positionX,positionY,
             opacity,backgroundColor,cornerRadius,
             borderWidth,shadowColor,shadowOffset,
             shadowOpacity,shadowRadius];
}

@end
